export { ElMessage } from 'element-plus'; // 这个可以直接交给外面使用
import { ElMessage } from 'element-plus';

interface IMessageConfig {
  type?: 'success' | 'warning' | 'info' | 'error';
  message?: string;
  duration?: number;
  'show-close'?: boolean;
  center?: boolean;
}
export function useMessage(messageConfig: IMessageConfig) {
  ElMessage({
    ...messageConfig
  });
}

export function useMessageSuccess(messageConfig: IMessageConfig) {
  useMessage({ ...messageConfig, type: 'success' });
}
export function useMessageError(messageConfig: IMessageConfig) {
  useMessage({ ...messageConfig, type: 'error' });
}
export function useMessageWarning(messageConfig: IMessageConfig) {
  useMessage({ ...messageConfig, type: 'error' });
}
export function useMessageInfo(messageConfig: IMessageConfig) {
  useMessage({ ...messageConfig, type: 'info' });
}
